﻿<Window x:Class="XmlStudio.Dialogs.AddAttributeDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        loc:Translate.Uid="AddAttributeDialog.WindowTitle"
        xmlns:userControls="clr-namespace:XmlStudio.Resources.UserControls" 
        xmlns:loc="clr-namespace:Tomers.WPF.Localization;assembly=Tomers.WPF.Localization" 
        xmlns:reg="clr-namespace:XmlStudio.Validators"
        Title="{loc:Translate 'Add an attribute'}"
        MinWidth="316"
        MinHeight="234"
        Style="{StaticResource XmlStudioDialogStyle}"
        WindowStartupLocation="CenterOwner"
        ResizeMode="CanResizeWithGrip"
        x:Name="AddAttribute">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <!--<ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Silver.xaml" />-->
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
        <Border BorderBrush="Gray" BorderThickness="1" Margin="{StaticResource DialogBoxMargin}" Background="{StaticResource DialogBackgoundBrush}">
            <Grid Margin="{StaticResource DialogBoxMargin}" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="{StaticResource GridRowHeight}"/>
                    <RowDefinition Height="{StaticResource GridRowHeight}" />
                    <RowDefinition Height="{StaticResource GridRowHeight}" />
                    <RowDefinition Height="{StaticResource GridRowHeight}" />
                    <RowDefinition Height="30*" />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="0" loc:Translate.Uid="AddAttributeDialog.Prefix" Text="{loc:Translate Prefix:}" />
                <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="1" loc:Translate.Uid="AddAttributeDialog.NamespaceURI" Text="{loc:Translate NamespaceURI:}" />
                <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="2" loc:Translate.Uid="AddAttributeDialog.LocalName" Text="{loc:Translate LocalName:}" />
                <TextBlock Height="{StaticResource TextBlockHeight}" Grid.Row="3" loc:Translate.Uid="AddAttributeDialog.Value" Text="{loc:Translate Value:}" />

                <TextBox Margin="{StaticResource TextBoxMargin}" Height="{StaticResource TextBoxHeight}" MinWidth="157" Grid.Column="1" Grid.Row="0" x:Name="prefixTextBox">
                    <TextBox.Text>
                        <Binding Path="Attribute.Prefix" UpdateSourceTrigger="Explicit">
                            <Binding.ValidationRules>
                                <reg:XmlValidationRule ValidationOptions="Prefix" />
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBox Margin="{StaticResource TextBoxMargin}" Height="{StaticResource TextBoxHeight}" MinWidth="157" Grid.Column="1" Grid.Row="1" x:Name="namespaceURITextBox">
                    <TextBox.Text>
                        <Binding Path="Attribute.NamespaceURI" UpdateSourceTrigger="Explicit">
                            <Binding.ValidationRules>
                                <reg:XmlValidationRule ValidationOptions="NamespaceUri" />
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBox Margin="{StaticResource TextBoxMargin}" Height="{StaticResource TextBoxHeight}" MinWidth="157" Grid.Column="1" Grid.Row="2" x:Name="localNameTextBox">
                    <TextBox.Text>
                        <Binding Path="Attribute.LocalName" UpdateSourceTrigger="Explicit">
                            <Binding.ValidationRules>
                                <reg:XmlValidationRule ValidationOptions="AttributeName" />
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>
                <TextBox Margin="{StaticResource TextBoxMargin}" Height="{StaticResource TextBoxHeight}" MinWidth="157" Grid.Column="1" Grid.Row="3" x:Name="valueTextBox">
                    <TextBox.Text>
                        <Binding Path="Attribute.Value" UpdateSourceTrigger="Explicit">
                            <Binding.ValidationRules>
                                <reg:XmlValidationRule ValidationOptions="AttributeValue" />
                            </Binding.ValidationRules>
                        </Binding>
                    </TextBox.Text>
                </TextBox>

                <userControls:OKCancelButtons OKClicked="Button_Click" Margin="0 7 0 0" Grid.Row="4" Grid.ColumnSpan="2" />
            </Grid>
        </Border>
    </ScrollViewer>
</Window>